package me.suntao.javaio.server.bio;

import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 多线程阻塞式IO
 * Created by suntao on 2017/6/2.
 */
public class MultiThreadEchoServer {
  private static final int DEFAULT_PORT = 28000;

  public static void main(String[] args){
    Socket clientSocket = null;
    try (ServerSocket serverSocket = new ServerSocket(DEFAULT_PORT)) {
      while (true){
        clientSocket = serverSocket.accept();
        new Thread(new EchoServerHandler(clientSocket)).start();
      }
    }catch (IOException e){
      e.printStackTrace();
    }
  }

}
